require("../../../../@babel/runtime/helpers/Arrayincludes"), require("../../../../@babel/runtime/helpers/Objectentries");

var e = require("../../../../@babel/runtime/helpers/slicedToArray"), t = require("../../../../@babel/runtime/helpers/typeof"), n = require("../../../../common/vendor.js"), r = require("./test.js"), o = require("./digit.js");

function i(e) {
    for (var t = this.$parent; t; ) {
        if (!t.$options || t.$options.name === e) return t;
        t = t.$parent;
    }
    return !1;
}

function a(n) {
    var r, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : new WeakMap();
    if (null === n || "object" != t(n)) return n;
    if (o.has(n)) return o.get(n);
    if (n instanceof Date) r = new Date(n.getTime()); else if (n instanceof RegExp) r = new RegExp(n); else if (n instanceof Map) r = new Map(Array.from(n, function(t) {
        var n = e(t, 2);
        return [ n[0], a(n[1], o) ];
    })); else if (n instanceof Set) r = new Set(Array.from(n, function(e) {
        return a(e, o);
    })); else if (Array.isArray(n)) r = n.map(function(e) {
        return a(e, o);
    }); else if ("[object Object]" === Object.prototype.toString.call(n)) {
        r = Object.create(Object.getPrototypeOf(n)), o.set(n, r);
        for (var i = 0, c = Object.entries(n); i < c.length; i++) {
            var u = e(c[i], 2), s = u[0], l = u[1];
            r[s] = a(l, o);
        }
    } else r = Object.assign({}, n);
    return o.set(n, r), r;
}

function c() {
    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
    if ("object" != t(e = a(e)) || null === e || "object" != t(n) || null === n) return e;
    var r = Array.isArray(e) ? e.slice() : Object.assign({}, e);
    for (var o in n) if (n.hasOwnProperty(o)) {
        var i = n[o], u = r[o];
        i instanceof Date ? r[o] = new Date(i) : i instanceof RegExp ? r[o] = new RegExp(i) : i instanceof Map ? r[o] = new Map(i) : i instanceof Set ? r[o] = new Set(i) : r[o] = "object" == t(i) && null !== i ? c(u, i) : i;
    }
    return r;
}

function u(e) {}

function s() {
    var t, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "yyyy-mm-dd", o = {
        y: (t = n ? /^\d{10}$/.test(null == n ? void 0 : n.toString().trim()) ? new Date(1e3 * n) : "string" == typeof n && /^\d+$/.test(n.trim()) ? new Date(Number(n)) : "string" == typeof n && n.includes("-") && !n.includes("T") ? new Date(n.replace(/-/g, "/")) : new Date(n) : new Date()).getFullYear().toString(),
        m: (t.getMonth() + 1).toString().padStart(2, "0"),
        d: t.getDate().toString().padStart(2, "0"),
        h: t.getHours().toString().padStart(2, "0"),
        M: t.getMinutes().toString().padStart(2, "0"),
        s: t.getSeconds().toString().padStart(2, "0")
    };
    for (var i in o) {
        var a = new RegExp("".concat(i, "+")).exec(r) || [], c = e(a, 1), u = c[0];
        if (u) {
            var s = "y" === i && 2 === u.length ? 2 : 0;
            r = r.replace(u, o[i].slice(s));
        }
    }
    return r;
}

function l(e) {
    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "both";
    return e = String(e), "both" == t ? e.replace(/^\s+|\s+$/g, "") : "left" == t ? e.replace(/^\s*/, "") : "right" == t ? e.replace(/(\s*$)/g, "") : "all" == t ? e.replace(/\s+/g, "") : e;
}

function f() {
    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "brackets", r = t ? "?" : "", o = [];
    -1 == [ "indices", "brackets", "repeat", "comma" ].indexOf(n) && (n = "brackets");
    var i = function(t) {
        var r = e[t];
        if (!([ "", void 0, null ].indexOf(r) >= 0)) if (r.constructor === Array) switch (n) {
          case "indices":
            for (var i = 0; i < r.length; i++) o.push("".concat(t, "[").concat(i, "]=").concat(r[i]));
            break;

          case "brackets":
          default:
            r.forEach(function(e) {
                o.push("".concat(t, "[]=").concat(e));
            });
            break;

          case "repeat":
            r.forEach(function(e) {
                o.push("".concat(t, "=").concat(e));
            });
            break;

          case "comma":
            var a = "";
            r.forEach(function(e) {
                a += (a ? "," : "") + e;
            }), o.push("".concat(t, "=").concat(a));
        } else o.push("".concat(t, "=").concat(r));
    };
    for (var a in e) i(a);
    return o.length ? r + o.join("&") : "";
}

function g(e) {
    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ".", r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : ",";
    e = "".concat(e).replace(/[^0-9+-Ee.]/g, "");
    var i = isFinite(+e) ? +e : 0, a = isFinite(+t) ? Math.abs(t) : 0, c = void 0 === r ? "," : r, u = void 0 === n ? "." : n, s = "";
    s = (a ? o.round(i, a) + "" : "".concat(Math.round(i))).split(".");
    for (var l = /(-?\d+)(\d{3})/; l.test(s[0]); ) s[0] = s[0].replace(l, "$1".concat(c, "$2"));
    return (s[1] || "").length < a && (s[1] = s[1] || "", s[1] += new Array(a - s[1].length + 1).join("0")), 
    s.join(u);
}

function d() {
    var e, t = getCurrentPages(), n = null == (e = t[t.length - 1]) ? void 0 : e.route;
    return "/".concat(n || "");
}

String.prototype.padStart || (String.prototype.padStart = function(e) {
    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : " ";
    if ("[object String]" !== Object.prototype.toString.call(t)) throw new TypeError("fillString must be String");
    var n = this;
    if (n.length >= e) return String(n);
    for (var r = e - n.length, o = Math.ceil(r / t.length); o >>= 1; ) t += t, 1 === o && (t += t);
    return t.slice(0, r) + n;
});

var p = Object.freeze(Object.defineProperty({
    __proto__: null,
    $parent: i,
    addStyle: function(e) {
        var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "object";
        if (r.empty(e) || "object" == t(e) && "object" === n || "string" === n && "string" == typeof e) return e;
        if ("object" === n) {
            for (var o = (e = l(e)).split(";"), i = {}, a = 0; a < o.length; a++) if (o[a]) {
                var c = o[a].split(":");
                i[l(c[0])] = l(c[1]);
            }
            return i;
        }
        var u = "";
        for (var s in e) u += "".concat(s.replace(/([A-Z])/g, "-$1").toLowerCase(), ":").concat(e[s], ";");
        return l(u);
    },
    addUnit: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "auto", t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function(e) {
            return null == (e = null == (t = null == (r = n.index) ? void 0 : r.$uv) ? void 0 : t.config) ? void 0 : e.unit;
            var t, r;
        }() ? function(e) {
            return null == (e = null == (t = null == (r = n.index) ? void 0 : r.$uv) ? void 0 : t.config) ? void 0 : e.unit;
            var t, r;
        }() : "px";
        return e = String(e), r.number(e) ? "".concat(e).concat(t) : e;
    },
    deepClone: a,
    deepMerge: c,
    error: u,
    formValidate: function(e, t) {
        var n = i.call(e, "uv-form-item"), r = i.call(e, "uv-form");
        n && r && r.validateField(n.prop, function() {}, t);
    },
    getDuration: function(e) {
        var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = parseInt(e);
        return t ? /s$/.test(e) ? e : "".concat(e, e > 30 ? "ms" : "s") : /ms$/.test(e) ? n : /s$/.test(e) ? n > 30 ? n : 1e3 * n : n;
    },
    getHistoryPage: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t = getCurrentPages();
        return t[t.length - 1 + e];
    },
    getProperty: function(e, t) {
        if (e) {
            if ("string" != typeof t || "" === t) return "";
            if (-1 !== t.indexOf(".")) {
                for (var n = t.split("."), r = e[n[0]] || {}, o = 1; o < n.length; o++) r && (r = r[n[o]]);
                return r;
            }
            return e[t];
        }
    },
    getPx: function(e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
        return r.number(e) ? t ? "".concat(e, "px") : Number(e) : /(rpx|upx)$/.test(e) ? t ? "".concat(n.index.upx2px(parseInt(e)), "px") : Number(n.index.upx2px(parseInt(e))) : t ? "".concat(parseInt(e), "px") : parseInt(e);
    },
    guid: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 32, t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, r = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), o = [];
        if (n = n || r.length, e) for (var i = 0; i < e; i++) o[i] = r[0 | Math.random() * n]; else {
            var a;
            o[8] = o[13] = o[18] = o[23] = "-", o[14] = "4";
            for (var c = 0; c < 36; c++) o[c] || (a = 0 | 16 * Math.random(), o[c] = r[19 == c ? 3 & a | 8 : a]);
        }
        return t ? (o.shift(), "u".concat(o.join(""))) : o.join("");
    },
    os: function() {
        return n.index.getSystemInfoSync().platform.toLowerCase();
    },
    padZero: function(e) {
        return "00".concat(e).slice(-2);
    },
    page: d,
    pages: function() {
        return getCurrentPages();
    },
    priceFormat: g,
    queryParams: f,
    random: function(e, t) {
        if (e >= 0 && t > 0 && t >= e) {
            var n = t - e + 1;
            return Math.floor(Math.random() * n + e);
        }
        return 0;
    },
    randomArray: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
        return e.sort(function() {
            return Math.random() - .5;
        });
    },
    range: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
        return Math.max(e, Math.min(t, Number(n)));
    },
    setConfig: function(e) {
        var t = e.props, r = void 0 === t ? {} : t, o = e.config, i = void 0 === o ? {} : o, a = e.color, c = void 0 === a ? {} : a, u = e.zIndex, s = void 0 === u ? {} : u, l = n.index.$uv.deepMerge;
        n.index.$uv.config = l(n.index.$uv.config, i), n.index.$uv.props = l(n.index.$uv.props, r), 
        n.index.$uv.color = l(n.index.$uv.color, c), n.index.$uv.zIndex = l(n.index.$uv.zIndex, s);
    },
    setProperty: function(e, n, r) {
        if (e) {
            if ("string" != typeof n || "" === n) ; else if (-1 !== n.indexOf(".")) {
                !function e(n, r, o) {
                    if (1 !== r.length) for (;r.length > 1; ) {
                        var i = r[0];
                        n[i] && "object" == t(n[i]) || (n[i] = {}), r.shift(), e(n[i], r, o);
                    } else n[r[0]] = o;
                }(e, n.split("."), r);
            } else e[n] = r;
        }
    },
    sleep: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 30;
        return new Promise(function(t) {
            setTimeout(function() {
                t();
            }, e);
        });
    },
    sys: function() {
        return n.index.getSystemInfoSync();
    },
    timeFormat: s,
    timeFrom: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "yyyy-mm-dd";
        null == e && (e = Number(new Date())), 10 == (e = parseInt(e)).toString().length && (e *= 1e3);
        var n = new Date().getTime() - e, r = "";
        switch (!0) {
          case (n = parseInt(n / 1e3)) < 300:
            r = "刚刚";
            break;

          case n >= 300 && n < 3600:
            r = "".concat(parseInt(n / 60), "分钟前");
            break;

          case n >= 3600 && n < 86400:
            r = "".concat(parseInt(n / 3600), "小时前");
            break;

          case n >= 86400 && n < 2592e3:
            r = "".concat(parseInt(n / 86400), "天前");
            break;

          default:
            r = !1 === t ? n >= 2592e3 && n < 31536e3 ? "".concat(parseInt(n / 2592e3), "个月前") : "".concat(parseInt(n / 31536e3), "年前") : s(e, t);
        }
        return r;
    },
    toast: function(e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2e3;
        n.index.showToast({
            title: String(e),
            icon: "none",
            duration: t
        });
    },
    trim: l,
    type2icon: function() {
        var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "success", t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
        -1 == [ "primary", "info", "error", "warning", "success" ].indexOf(e) && (e = "success");
        var n = "";
        switch (e) {
          case "primary":
          case "info":
            n = "info-circle";
            break;

          case "error":
            n = "close-circle";
            break;

          case "warning":
            n = "error-circle";
            break;

          default:
            n = "checkmark-circle";
        }
        return t && (n += "-fill"), n;
    }
}, Symbol.toStringTag, {
    value: "Module"
}));

exports.deepClone = a, exports.deepMerge = c, exports.error = u, exports.index = p, 
exports.page = d, exports.priceFormat = g, exports.queryParams = f, exports.timeFormat = s;